package lcr;

public class Test0019 {
    public static void main(String[] args) {
        Solution0019_1 solution0019_1 = new Solution0019_1();
        System.out.println(solution0019_1.validPalindrome("abc"));
    }
}
class Solution0019_1 {
    public boolean validPalindrome(String s) {
        char[] charArray = s.toCharArray();
        return isPalindrome(charArray, 0, charArray.length-1,true);
    }

    public boolean isPalindrome(char[] charArray, int l, int r,boolean flag){
        if (l>=r){
            return true;
        }

        if (charArray[l]==charArray[r]){
            return isPalindrome(charArray, l+1, r-1, flag);
        }

        if (flag){
            return isPalindrome(charArray, l+1, r,false)||isPalindrome(charArray, l, r-1,false);
        }

        return false;
    }
}
